< previous page page_146 next page >

Page 146
Width. Sets the width of the paper. You can use Height and Width instead of one of the predefined values for PaperSize.
Zoom. Determines the percentage by which output is scaled up or down.
Printer Control Methods
The Printer object has several methods you need to use to control printing. Some of the most important are NewPage, EndDoc, and KillDoc. NewPage starts a new page, resetting CurrentX and CurrentY to the upper-left corner of the new page.
EndDoc finishes the current print job and sends it to the physical printer. If your program exits without calling EndDoc or KillDoc, the system implicitly sends an EndDoc command. Until you execute EndDoc, output to the printer is buffered and does not appear.
When printing a typical long document, you would execute the NewPage method several times to create the document's pages. You would use EndDoc once when the document was finished.
The Printer object's KillDoc method cancels the current print job.
If you use EndDoc immediately after NewPage, Visual Basic does not print an extra blank page at the end. As a result, you can use NewPage after every page without worrying about whether you are at the end of the document.
In fact, the NewPage method will not print a page that is blank even if you want it to. If you want to display a blank page, use the Print method to display a space character on the page and then use NewPage as in the following code.
e10a6a0a59f035e870d90cca05b85fce.gif
Printer.Print "Hello"     ' Put something on page 1.
Printer.NewPage           ' Print page 1.
Printer.Print " "         ' Put a space character on page 2.
Printer.NewPage           ' Print the blank page 2.
Printer.EndDoc            ' End the document.
The PrintForm Method
The PrintForm method is by far the easiest way to print. Simply invoke a form object's PrintForm method, and the form sends an image of itself, including any controls it contains to the printer. If the form's AutoRedraw property is set to true, the printout also includes any graphics you have drawn on the form. While this method is extremely simple, it has a couple of drawbacks.
First, PrintForm can display graphics drawn on the form only if AutoRedraw is true. This means your program must use more memory than it might otherwise need if you want to print those graphics.

 
< previous page page_146 next page >